package com.fansaikj.crm;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import xyz.erupt.core.annotation.EruptScan;

import java.awt.*;
import java.net.URI;

@SpringBootApplication
@EntityScan
@EruptScan
public class EruptCrmApplication {

    //详细使用方法详见项目内 README.md 文件说明
    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(EruptCrmApplication.class, args);
        Environment env = context.getBean(Environment.class);
        try {
            System.setProperty("java.awt.headless", "false");
            Desktop.getDesktop().browse(new URI("http://localhost:" + env.getProperty("server.port")));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
